package com.pingan.haofang.searchcloud.index.domain;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

/**
 * 索引构建过程
 * 
 * @author LUYI374
 * @date May 16, 2017
 * @since 1.0.0
 */
@Entity
@Table(name = "t_index_build_progress")
public class IndexBuildProgress {

    /**
     * ID
     */
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "id")
    private Long id;

    /**
     * 项目code
     */
    @Column(name = "project_code")
    private String projectCode;

    /**
     * 索引名称
     */
    @Column(name = "index_name")
    private String indexName;

    /**
     * 数据源名称
     */
    @Column(name = "datasource_name")
    private String datasourceName;

    /**
     * 运行类型 0：定时触发 1：人工触发
     */
    @Column(name = "run_type")
    private Integer runType;

    /**
     * 索引构建类型 0：基准 1：增量
     */
    @Column(name = "index_build_type")
    private Integer indexBuildType;

    /**
     * 状态 0：待执行 1：执行中 2：成功 3：失败
     */
    @Column(name = "status")
    private Integer status;

    /**
     * 启动时间
     */
    @Column(name = "start_time")
    private Date startTime;

    /**
     * 实际执行开始时间
     */
    @Column(name = "execute_start_time")
    private Date executeStartTime;

    /**
     * 实际执行结束时间
     */
    @Column(name = "execute_end_time")
    private Date executeEndTime;

    /**
     * 执行消耗总时间
     */
    @Column(name = "execute_cost_time")
    private long executeCostTime;

    /**
     * collection名称
     */
    @Column(name = "collection_name")
    private String collectionName;

    /**
     * 抓取成功记录数
     */
    @Column(name = "fetch_success_count")
    private long fetchSuccessCount;

    /**
     * 抓取总记录数
     */
    @Column(name = "fetch_total_count")
    private long fetchTotalCount;

    /**
     * 导入成功记录数
     */
    @Column(name = "import_success_count")
    private long importSuccessCount;

    /**
     * 导入总记录数
     */
    @Column(name = "import_total_count")
    private long importTotalCount;

    /**
     * 配置快照
     */
    @Column(name = "config_snapshot")
    private String configSnapshot;

    /**
     * 失败原因
     */
    @Column(name = "fail_reason")
    private String failReason;

    /**
     * rpc拉取数据耗时
     */
    @Column(name="rpc_cost_time")
    private long rpcCostTime;

    /**
     * 数据导入到solr / es 耗时
     */
    @Column(name="data_import_cost_time")
    private long dataImportCostTime;

    /**
     * 最后更新时间
     */
    @Column(name = "update_time", insertable = false, updatable = false)
    private Date updateTime;
    
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getProjectCode() {
        return projectCode;
    }

    public void setProjectCode(String projectCode) {
        this.projectCode = projectCode;
    }

    public String getIndexName() {
        return indexName;
    }

    public void setIndexName(String indexName) {
        this.indexName = indexName;
    }

    public Integer getRunType() {
        return runType;
    }

    public void setRunType(Integer runType) {
        this.runType = runType;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public Date getStartTime() {
        return startTime;
    }

    public void setStartTime(Date startTime) {
        this.startTime = startTime;
    }

    public Date getExecuteStartTime() {
        return executeStartTime;
    }

    public void setExecuteStartTime(Date executeStartTime) {
        this.executeStartTime = executeStartTime;
    }

    public Date getExecuteEndTime() {
        return executeEndTime;
    }

    public void setExecuteEndTime(Date executeEndTime) {
        this.executeEndTime = executeEndTime;
    }

    public long getExecuteCostTime() {
        return executeCostTime;
    }

    public void setExecuteCostTime(long executeCostTime) {
        this.executeCostTime = executeCostTime;
    }

    public String getCollectionName() {
        return collectionName;
    }

    public void setCollectionName(String collectionName) {
        this.collectionName = collectionName;
    }

    public long getFetchSuccessCount() {
        return fetchSuccessCount;
    }

    public void setFetchSuccessCount(long fetchSuccessCount) {
        this.fetchSuccessCount = fetchSuccessCount;
    }

    public long getFetchTotalCount() {
        return fetchTotalCount;
    }

    public void setFetchTotalCount(long fetchTotalCount) {
        this.fetchTotalCount = fetchTotalCount;
    }

    public long getImportSuccessCount() {
        return importSuccessCount;
    }

    public void setImportSuccessCount(long importSuccessCount) {
        this.importSuccessCount = importSuccessCount;
    }

    public long getImportTotalCount() {
        return importTotalCount;
    }

    public void setImportTotalCount(long importTotalCount) {
        this.importTotalCount = importTotalCount;
    }

    public Integer getIndexBuildType() {
        return indexBuildType;
    }

    public void setIndexBuildType(Integer indexBuildType) {
        this.indexBuildType = indexBuildType;
    }

    public String getConfigSnapshot() {
        return configSnapshot;
    }

    public void setConfigSnapshot(String configSnapshot) {
        this.configSnapshot = configSnapshot;
    }

    public String getFailReason() {
        return failReason;
    }

    public void setFailReason(String failReason) {
        this.failReason = failReason;
    }

    public String getDatasourceName() {
        return datasourceName;
    }

    public void setDatasourceName(String datasourceName) {
        this.datasourceName = datasourceName;
    }

    public long getRpcCostTime() {
        return rpcCostTime;
    }

    public void setRpcCostTime(long rpcCostTime) {
        this.rpcCostTime = rpcCostTime;
    }

    public long getDataImportCostTime() {
        return dataImportCostTime;
    }

    public void setDataImportCostTime(long dataImportCostTime) {
        this.dataImportCostTime = dataImportCostTime;
    }

	public Date getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}
    
}
